package ooad.nextgen.gof.strategy;

import ooad.nextgen.domain.Money;
import ooad.nextgen.domain.Sale;

/**
 * 按百分比打折销售策略
 * 如9折，即percentage = 0.9
 */
public class PercentDiscountPricingStrategy implements ISalePricingStrategy{
	private float percentage = 0.9F;
	public PercentDiscountPricingStrategy() {
		super();
	}
	public PercentDiscountPricingStrategy(float percentage) {
		super();
		this.percentage = percentage;
	}
	@Override
	public Money getTotal(Sale sale) {
                
		return sale.getPreDiscountTotal().discount(percentage);
	}

}
